<%--
Document : index
Created on : Jan 5, 2011, 3:07:11 PM
Author : leontan
--%>
<%@ page import="org.dopdf.document.PDFDocument" %>
<%@ page import="java.io.FileInputStream" %>
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <!-- adding the doPDF.css to the web-page -->
    <link rel="stylesheet" type="text/css" media="screen" href="/do-pdf-trial/do-pdf-test/static/styles/doPDF.css"><!-- //required for FF3 and Opera --></link>
    <!-- do-pdf is based on jquery, hence adding the reference of jquery.min.js to the web-page.
If you are already using jquery then you can add the reference of jquery javascript used by your application. -->
    <script src="/do-pdf-trial/do-pdf-test/static/js/jquery/jquery.min.js" type="text/javascript"></script>
    <!-- Adding the reference of the doPDF.js which shows the pdf viewer on the web-page -->
    <script src="/do-pdf-trial/do-pdf-test/static/js/doPDF.js" type="text/javascript"></script>
</head>
<body>
<h1>Hello World!</h1>

        <div class="viewer">

        </div>

<% final PDFDocument pdfDocument = new PDFDocument(request.getSession().getServletContext().getResourceAsStream("/hibernate_reference.pdf"));%>
<script type="text/javascript">
    $(function() {
        new PDFViewer({
            document: {
                id: "<%=pdfDocument.getId() %>",
                numberOfPages: <%= pdfDocument.getNumberOfPages() %>
            },
            urlParts: {
                contextRoot: "/do-pdf-trial/",
                filterMapping: "do-pdf-test"
            }
        }).show();
    });
</script>
</body>
</html>